package com.mproject.activity;

import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;

import com.mproject.adapter.Dashboard_List_Project_Adapter;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.AdapterView.OnItemClickListener;

public class Dashboard_Upcoming extends Activity {

	/** Called when the activity is first created. */
	public final static String name= "Item one";  
	public final static String start = "Item two";
	public final static String detail = "Item three";

	List<Map<String,?>> project_leading;
	List<Map<String,?>> project_joining;
	
	private ListView project_list;
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.dashboard_upcoming_list);  
		
		project_list = (ListView) findViewById(R.id.dashboard_list_upcoming);

		//testting - static value here
		project_leading = new LinkedList<Map<String,?>>();  
		project_leading.add(createItem("Software Engineering", "7 AM", "COM1"));  

		project_joining = new LinkedList<Map<String,?>>();  
		project_joining.add(createItem("Database System Management", "12 PM", "28-05-12"));
		project_joining.add(createItem("Software Engineering Design", "9 PM", ""));

		Dashboard_List_Project_Adapter adapter = new Dashboard_List_Project_Adapter(this);
		adapter.addSection("Today", new SimpleAdapter(this, project_leading, R.layout.dashboard_upcoming_list_item,  
				new String[] { name, start, detail }, new int[] { R.id.dashbpard_upcoming_name, R.id.dashbpard_upcoming_starttime, R.id.dashbpard_upcoming_detail}));
		adapter.addSection("24-5-2012", new SimpleAdapter(this, project_joining, R.layout.dashboard_upcoming_list_item,  
				new String[] { name, start, detail }, new int[] { R.id.dashbpard_upcoming_name, R.id.dashbpard_upcoming_starttime, R.id.dashbpard_upcoming_detail}));

		project_list.setAdapter(adapter);

		project_list.setOnItemClickListener(new OnItemClickListener() {
			public void onItemClick(AdapterView<?> listView, View itemView, int position, long id) {

			}
		});
		
		
	}
	public Map<String,?> createItem(String name, String start, String detail) {  
		Map<String,String> item = new HashMap<String,String>();  
		item.put(this.name, name);  
		item.put(this.start, start);  
		item.put(this.detail, detail);  
		return item;  
	}
}
